<?php
//测试控制器类
class IndexController extends Controller{
    //动作方法
	public function index(){
		$tree = Dir::tree('backup');
		$this->assign('tree',$tree);
		$this->display();
	}
    //数据还原
	public function re(){
		$dir = "backup/".$_GET['dir'];
		$result = Backup::recovery(array('dir' => $dir));
    	if ($result === false) {// 还原发生错误
    		$this->error(Backup::$error, 'index'); 
    	} else {
    		if ($result['status'] == 'success') {
    			$this->success('还原完毕', U('index'));
    		} else {// 备份运行中 ...
    			$this->success($result['message'], $result['url'], 0.2);
    		}
    	}
    }
}
?>